import Vue from 'vue';

import http from '@src/util/HttpUtil';
import mtracker from '@src/util/mtracker';

import router from './router';
import store from './store';

import App from './app.vue';
// import Bbx from 'pub-bbx-pc';
// import 'pub-bbx-pc/lib/theme-chalk/index.css';
// Vue.use(Bbx);

Vue.prototype.$http = http;
mtracker();

// 处理注入的参数
let initData = {};

try {
  initData = typeof window._init === 'string'
    ? JSON.parse(window._init || '{}')
    : window._init;
} catch (error) {
  console.warn(error);
  console.warn('no init data');
}

store.commit('setInitData', Object.freeze(initData));

let app = {
  router,
  store,
  provide: {
    initData: Object.freeze(initData),
  },
  render: h => h(App)
}

export default app;
